﻿using System;
using System.Collections.Generic;

namespace YJKArch.Utils.Generics
{
	internal class KeyPointComparer : IEqualityComparer<KeyPoint>
	{
		public bool Equals(KeyPoint p, KeyPoint q)
		{
			return p.IsAlmostEqualTo(q, 0.032);
		}

		public int GetHashCode(KeyPoint p)
		{
			string text = (p.X / 10.0).ToString("#0");
			string text2 = (p.Y / 10.0).ToString("#0");
			string text3 = (p.Z / 10.0).ToString("#0");
			return string.Concat(new string[]
			{
				"(",
				text,
				",",
				text2,
				",",
				text3,
				")"
			}).GetHashCode();
		}
	}
}
